/** @format */
import {createStore} from 'redux';

interface IAction {
  type: string;
  val: any;
}

interface IData {
  [props: string]: any;
}

const data: IData = {
  isStretch: false,
  audioSrc: '',
};

const counter = (state?: IData, action?: any): IData => {
  if (action) {
    data[action.type] = action.val;
  }
  return data;
};

// API 是 { subscribe, dispatch, getState }。
const store = createStore(counter);

export {store};
